const path = require('path')

function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    publicPath: process.env.NODE_ENV !== 'production' ? './' : './',
    assetsDir: 'static',
    productionSourceMap: true,
    filenameHashing: false,
    chainWebpack: config => {
        config.devtool = 'source-map'
        config.resolve.alias
            .set('@', resolve('src'))
            .set('src', resolve('src'))
            .end()
    },
    css: {
        extract: process.env.NODE_ENV === 'production'
    },
    devServer: {
        open: true,
        host: '0.0.0.0',
        port: 8080,
        before(app, server) {
            const testApp = require('./app')
            testApp(app)
        }
    }
}